package com.xinqing.bigdata.rdd

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
  * @Author:CHQ
  * @Date:2020 /6/19 19:21
  * @Description
  */
object GlomTransform {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local[*]").setAppName("create RDD")
    val sc = new SparkContext(conf)
    val glomRDD: RDD[Int] = sc.makeRDD(List(1, 2, 3), 2)

    //glom将同一个分区的数据放入一个Array数据中进行批处理   3/2=1余1
    glomRDD.glom().collect().foreach({
      array => println(array.mkString(","))   //先collect，后println
    })
  }
}
